home *** CD-ROM | disk | FTP | other *** search
- Path: oreig.uji.es!ii201
- From: ii201@rossegat.uji.es (Villellas Guillen Oscar)
- Newsgroups: comp.sys.amiga.programmer,uiuc.class.cs110c,uiuc.class.cs223
- Subject: Re: How do I define my integers?
- Followup-To: comp.sys.amiga.programmer,uiuc.class.cs110c,uiuc.class.cs223
- Date: 19 Jan 1996 15:28:46 GMT
- Organization: Universitat Jaume I. Castell≤ de la Plana. Spain
- Message-ID: <4dodbe$2vf@oreig.uji.es>
- References: <4d73ug$25v@vixen.cso.uiuc.edu>
- NNTP-Posting-Host: @rossegat.uji.es
- X-Newsreader: TIN [version 1.2 PL2]
-
- howard daniel joseph (djhoward@ux5.cso.uiuc.edu) wrote:
- > Okay. I'm writing a program under GCC on my Amiga.
-
- > But I'm confused to hell over integer limits.
-
- > My book talks about 2 bit and 4 bit integers ... and four bit
- > integers like what it describers long integers to be. Of course there's
- > unsigned integers and the like too.
-
- There are 16bits(2byte) and 32bits(4byte) integers.
-
- > How do I declare signed versus unsigned integers?
-
- Use the 'unsigned' keyword to declare unsigned ints.
-
- > How do I know how many bits my integers are using?
-
- By compiling in your compiler a program that displays
- sizeof(int). :)
-
- or use the 'short' (16 bits) or 'long' (32 bits) keywords.
-
- Examples:
- unsigned short int X; /* X is 16 bits unsigned */
- short int Y; /* Y is 16 bits signed */
- unsigned long int Z; /* Z is 32 bits , unsigned */
- long int Q; /* Guess it */
-
- > How do I declare signed and unsigned long integers?
- See above.
-
- > What's with these "doubles" the book mysteriously alludes to?
- Maybe you're talking about 'double' types?
- if so, they are floating point (8 bytes, opposed to 4 bytes
- used by float).
-
- > What *am* I creating when I type;
-
- > int somevalue;
- > (ie Is it signed/unsigned? How many bits?)
- Signed. No of bits depends on your compiler/compilation
- flags.
-
- > I know many of the answers here, but if I could get them all from one
- > source I'd feel a lot better.
-
- > I need two sorts of values for my project;
-
- > An integer (unsigned) that can handle, 6, though ideally 9 places (Just
- > under 250000000 would be the maximum forseen possible value here.)
- long ints would do a good job.
-
- > An integer that can handle a much bigger number ... 12 places at least for
- > now.
-
- Sorry, there's not a type to accomodate such a beast.
- Are you sere you need all of them???
-
- > Can I perform simple maths (addition, division) between integers of
- > different types? I'd assume so, right?
-
- Yes, I think...
-
- --
- //\\\
- /o \\
- +-----oooO--(_)--Oooo-----+ _ _
- | Oscar Villellas Guillen | ////
- +-------------------------+ _ _ ////
- | | | \\\X///
- ooO Ooo \XXX/ Always...
- ii201@rossegat.uji.es
-